package com.cyan.app.workflow.activity.SFC;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.cyan.app.workflow.R;
import com.cyan.app.workflow.base.activity.BaseFragmentActivity;
import com.cyan.app.workflow.fragment.SFC.SFCFragment;

public class SFCActivity extends BaseFragmentActivity {
    private FragmentTransaction ft;
    private SFCFragment mSFCFragment;
    private TextView mTextView;
    private Button mButton;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sfc);
        initView();
        ft = getSupportFragmentManager().beginTransaction();
        if (mSFCFragment == null) {
            mSFCFragment = new SFCFragment();
            ft.add(R.id.sfc_content_frame, mSFCFragment, SFCFragment.TAG);
        } else {
            ft.show(mSFCFragment);
            mSFCFragment.onResume();
        }
        ft.commitAllowingStateLoss();
    }

    private void initView(){
        titleBar();
    }

    private void titleBar(){
        mTextView =(TextView)findViewById(R.id.top_title_info);
        mTextView.setText("工单管理");
        Button back = (Button) findViewById(R.id.top_title_back);
        back.getBackground().setAlpha(255);// 透明度0~255透明度值 ，值越小越透明
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //返回按钮
                finish();
                //onKeyDown(KeyEvent.KEYCODE_BACK, null);
            }
        });
        mButton= (Button)findViewById(R.id.top_title_refres_with_icon);
        mButton.setVisibility(View.VISIBLE);
        mButton.setText("助手");

        //代码设置按钮左侧显示图片
//        Drawable drawable= getResources().getDrawable(R.drawable.xxx);
//        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
//        mButton.setCompoundDrawables(drawable, null, null, null);
    }
}
